package Operation.impl;

import Operation.IOperation;
import book.Book;
import book.BookList;

public class AddOperation implements IOperation {

    @Override
    public void work(BookList bookList) {
        System.out.println("欢迎来到添加图书操作~~~~~");
        System.out.println("请输入你要添加的书籍名称");
        String booksName =scanner.next();
        if (bookList.contains(booksName)) {
            System.out.println("书本已经存在，无需重复添加~");
            return;
        }
        System.out.println("请输入你要添加的书籍作者");
        String author=scanner.next();
        System.out.println("请输入你要添加的书籍价格");
        double price=scanner.nextInt();
        System.out.println("请输入你要添加的书籍类型");
        String type=scanner.next();
        Book book=new Book(booksName,author,price,type);
        bookList.add(book);
        System.out.println("添加书籍成功~~~~");
    }
}
